Skip to content

fix: resolve Storybook build errors and improve CI workflow#458

Merged
hotlong merged 3 commits intomainfrom
copilot/fix-storybook-errors
Feb 11, 2026
Merged

fix: resolve Storybook build errors and improve CI workflow#458
hotlong merged 3 commits intomainfrom
copilot/fix-storybook-errors

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 11, 2026

pnpm storybook:build fails with "createHash" is not exported by "__vite-browser-external" because @objectstack/core imports Node.js crypto in browser builds. Dev mode suffers from repeated 504 Outdated Optimize Dep errors causing blank preview iframes. CI workflow was missing package build steps and had no caching.

.storybook/main.ts

  • Add viteCryptoStub() plugin — the stub already existed at scripts/vite-crypto-stub.ts and was used by apps/console, but was missing from the Storybook Vite config
  • Add process.env/process.platform/process.version defines for browser compat (mirrors console config)
  • Pre-bundle @objectstack/* runtime packages via optimizeDeps.include to eliminate dep discovery reloads on first page load
  • Set build.target: 'esnext'
import { viteCryptoStub } from '../scripts/vite-crypto-stub';

// in viteFinal:
plugins: [viteCryptoStub()],
define: {
  'process.env': {},
  'process.platform': '"browser"',
  'process.version': '"0.0.0"',
},
optimizeDeps: {
  include: [
    '@objectstack/runtime',
    '@objectstack/objectql',
    '@objectstack/driver-memory',
    '@objectstack/plugin-msw',
    // ...
  ],
},

.github/workflows/storybook-tests.yml

  • Split into two jobs: storybook-build (build verification, ~5min) → storybook-test (Playwright test-runner)
  • Add pnpm build before Storybook — packages must be built first
  • Add pnpm + turbo caching, --frozen-lockfile, permissions: contents: read
  • Install only Chromium instead of all browsers

Storybook working after fix


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
objectui Ready Ready Preview, Comment Feb 11, 2026 8:22pm
objectui-demo Ready Ready Preview, Comment Feb 11, 2026 8:22pm
objectui-storybook Error Error Feb 11, 2026 8:22pm

Request Review

@hotlong hotlong marked this pull request as ready for review February 11, 2026 16:32
Copilot AI review requested due to automatic review settings February 11, 2026 16:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Copilot AI and others added 2 commits February 11, 2026 17:05
- Add viteCryptoStub() plugin to resolve @objectstack/core's crypto.createHash
  import that fails during browser builds
- Add process.env/platform/version defines for browser compatibility
- Add optimizeDeps.include for @objectstack/* runtime packages to reduce
  504 Outdated Optimize Dep errors during dev mode
- Set build.target to esnext for production builds

Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix various errors in Storybook controls browser fix: resolve Storybook build errors and improve CI workflow Feb 11, 2026
Copilot AI requested a review from hotlong February 11, 2026 17:21
@hotlong hotlong merged commit 0cae64f into main Feb 11, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants